home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
term-source.lha
/
DayPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-07
|
4KB
|
207 lines
/*
** DayPanel.c
**
** Editing panel for day of week selection
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include "termGlobal.h"
enum { GAD_USE=1,GAD_CANCEL,GAD_TEXT };
BYTE __regargs
DayPanel(struct TimeDateNode *Node)
{
struct LayoutHandle *Handle;
struct TimeDateNode LocalNode;
BYTE Result = FALSE;
LocalNode = *Node;
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
LH_ExitFlush, FALSE,
TAG_DONE))
{
struct Window *PanelWindow;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_DAYPANEL_ACTIVE_DAYS_GAD,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
WORD i;
for(i = 0 ; i < 7 ; i++)
{
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_DAYPANEL_MONDAY_GAD + i,
LA_ID, GAD_TEXT + i,
GTCB_Checked, LocalNode . Header . Day & (1L << i),
TAG_DONE);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, XBAR_KIND,
TAG_DONE);
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_GLOBAL_COMMENT_GAD,
LA_STRPTR, LocalNode . Header . Comment,
LA_Chars, 15,
GTST_MaxChars, 19,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_DAYPANEL_DAY_SETTINGS_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
GuideContext(CONTEXT_DAY);
LT_ShowWindow(Handle,TRUE);
PushWindow(PanelWindow);
do
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
break;
while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
GT_ReplyIMsg(Message);
LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
if(MsgClass == IDCMP_CLOSEWINDOW)
Done = TRUE;
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
LT_UpdateStrings(Handle);
*Node = LocalNode;
Result = Done = TRUE;
break;
case GAD_CANCEL:
Done = TRUE;
break;
default:
if(MsgGadget -> GadgetID >= GAD_TEXT && MsgGadget -> GadgetID < GAD_TEXT + 7)
{
LONG Index = MsgGadget -> GadgetID - GAD_TEXT;
if(MsgCode)
LocalNode . Header . Day |= (1L << Index);
else
LocalNode . Header . Day &= ~(1L << Index);
}
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
return(Result);
}